package com.vision.core.cl;

import com.sencha.gxt.widget.core.client.form.Validator;
import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;


/**
 * 
 * @author Mark
 *
 */
public class CoreValidators {
	
	public static final String ALPHANUMERIC_REGEX = "^[a-zA-Z0-9!@#$%\\^&\\*\\(\\)\\-\\+_=\\{\\}\\|\\[\\]\\\\:\";'<>?,\\./]+( [a-zA-Z0-9_\\-/]+)*$";

	public static final String NAME_REGEX = "^[a-zA-Z]+( [a-zA-Z]+)*$";
	
	public static final Validator<String> NAME_VALIDATOR =
			new RegExValidator(NAME_REGEX, "Must contain only letters.");
	
	public static final String MIDDLE_NAME_REGEX = "^([a-zA-Z]+( [a-zA-Z]+)*)*$";
	
	public static final Validator<String> MIDDLE_NAME_VALIDATOR =
			new RegExValidator(MIDDLE_NAME_REGEX, "Must contain only letters.");
	
	public static final String USERNAME_REGEX = "[a-zA-Z][a-zA-Z0-9]*";
	
	public static final Validator<String> USERNAME_VALIDATOR =
			new RegExValidator(USERNAME_REGEX, "Invalid username format. Must start with a letter and may contain only letters and numbers.");

	public static final String EMAIL_REGEX = "^(\\w+)([-+.][\\w]+)*@(\\w[-\\w]*\\.){1,5}([A-Za-z]){2,4}$";
	
	public static final Validator<String> EMAIL_VALIDATOR = 
			new RegExValidator(EMAIL_REGEX, "Invalid email address format.");
	
}
